<?php
/**
 * Created by PhpStorm.
 * User: Kenny.Hu
 * Date: 2016/1/29
 * Time: 13:20
 */

function ref_url(){
    return utf8_encode('http://'.$_SERVER['SERVER_NAME'].$_SERVER["REQUEST_URI"]);
}

/**
 * 将字符串分割成数组
 *
 * @param $string
 * @return array
 */
function letter_slice($string){
    $len = strlen($string);
    $rs  = array();
    for($i = 0; $i < $len; $i++){
        $rs[] = $string[$i];
    }
    return $rs;
}

/**
 * 检验有效金额字符串
 *
 * @param $input
 * @return bool
 */
function check_price($input){
    $preg = '/^\d+$|^\d+\.\d{1,2}$/';
    preg_match($preg, $input, $matches);
    return empty($matches) ? false : true;
}